'\" te
.\"  Copyright 1989 AT&T  Copyright (c) 1996, Sun Microsystems, Inc.  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH SDIFF 1 "Feb 17, 2023"
.SH NAME
sdiff \- print differences between two files side-by-side
.SH SYNOPSIS
.nf
\fBsdiff\fR [\fB-l\fR] [\fB-s\fR] [\fB-o\fR \fIoutput\fR] [\fB-w\fR \fIn\fR] \fIfilename1\fR \fIfilename2\fR
.fi

.SH DESCRIPTION
\fBsdiff\fR uses the output of the \fBdiff\fR command to produce a side-by-side
listing of two files indicating lines that are different. Lines of the two
files are printed with a blank gutter between them if the lines are identical,
a \fB<\fR in the gutter if the line appears only in \fIfilename1\fR, a \fB>\fR
in the gutter if the line appears only in \fIfilename2\fR, and a \fB|\fR for
lines that are different. (See the \fBEXAMPLES\fR section below.)
.SH OPTIONS
.ne 2
.na
\fB\fB-l\fR\fR
.ad
.RS 14n
Print only the left side of any lines that are identical.
.RE

.sp
.ne 2
.na
\fB\fB-s\fR\fR
.ad
.RS 14n
Do not print identical lines.
.RE

.sp
.ne 2
.na
\fB\fB-o\fR\fI output\fR \fR
.ad
.RS 14n
Use the argument \fIoutput\fR as the name of a third file that is created as a
user-controlled merge of \fIfilename1\fR and \fIfilename2\fR. Identical lines
of \fIfilename1\fR and \fIfilename2\fR are copied to \fIoutput\fR. Sets of
differences, as produced by \fBdiff\fR, are printed; where a set of differences
share a common gutter character. After printing each set of differences,
\fBsdiff\fR prompts the user with a \fB%\fR and waits for one of the following
user-typed commands:
.sp
.ne 2
.na
\fB\fBl\fR\fR
.ad
.RS 7n
Append the left column to the output file.
.RE

.sp
.ne 2
.na
\fB\fBr\fR\fR
.ad
.RS 7n
Append the right column to the output file.
.RE

.sp
.ne 2
.na
\fB\fBs\fR\fR
.ad
.RS 7n
Turn on silent mode; do not print identical lines.
.RE

.sp
.ne 2
.na
\fB\fBv\fR\fR
.ad
.RS 7n
Turn off silent mode.
.RE

.sp
.ne 2
.na
\fB\fBe l\fR\fR
.ad
.RS 7n
Call the editor with the left column.
.RE

.sp
.ne 2
.na
\fB\fBe r\fR\fR
.ad
.RS 7n
Call the editor with the right column.
.RE

.sp
.ne 2
.na
\fB\fBe b\fR\fR
.ad
.RS 7n
Call the editor with the concatenation of left and right.
.RE

.sp
.ne 2
.na
\fB\fBe\fR\fR
.ad
.RS 7n
Call the editor with a zero length file.
.RE

.sp
.ne 2
.na
\fB\fBq\fR\fR
.ad
.RS 7n
Exit from the program.
.RE

On exit from the editor, the resulting file is concatenated to the end of the
\fIoutput\fR file.
.RE

.sp
.ne 2
.na
\fB\fB-w\fR\fI n\fR \fR
.ad
.RS 14n
Use the argument \fIn\fR as the width of the output line. The default line
length is 130 characters.
.RE

.SH USAGE
See \fBlargefile\fR(7) for the description of the behavior of \fBsdiff\fR when
encountering files greater than or equal to 2 Gbyte (2^31 bytes).
.SH EXAMPLES
\fBExample 1 \fRAn example of the \fBsdiff\fR command.
.sp
.LP
A sample output of \fBsdiff\fR follows.

.sp
.in +2
.nf
x   |   y
a       a
b   <
c   <
d       d
    >   c
.fi
.in -2
.sp

.SH ENVIRONMENT VARIABLES
If any of the \fBLC_*\fR variables (\fBLC_CTYPE\fR, \fBLC_MESSAGES\fR,
\fBLC_TIME\fR, \fBLC_COLLATE\fR, \fBLC_NUMERIC\fR, and \fBLC_MONETARY\fR) (see
\fBenviron\fR(7)) are not set in the environment, the operational behavior of
\fBsdiff\fR for each corresponding locale category is determined by the value
of the \fBLANG\fR environment variable.  If \fBLC_ALL\fR is set, its contents
are used to override both the \fBLANG\fR and the other \fBLC_*\fR variables.
If none of the above variables is set in the environment, the "C" locale
determines how \fBsdiff\fR behaves.
.sp
.ne 2
.na
\fB\fBLC_CTYPE\fR \fR
.ad
.RS 13n
Determines how \fBsdiff\fR handles characters. When \fBLC_CTYPE\fR is set to a
valid value, \fBsdiff\fR can display and handle text and filenames containing
valid characters for that locale.
.RE

.SH ATTRIBUTES
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
CSI	Enabled
.TE

.SH SEE ALSO
.BR diff (1),
.BR ed (1),
.BR attributes (7),
.BR environ (7),
.BR largefile (7)
